package com.open.exam.common;

import java.io.File;

/**
 * 考点服务器路径
 * Created by admin on 2017/11/28.
 */
public class ExamSitePath {

    static {
        String osName = System.getProperty("os.name").toLowerCase();
        if(osName.indexOf("linux") != -1){
            String root = "/data/server/examplan";
            File file = new File(root);
            if(!file.exists()){
                file.mkdirs();
            }
            rootPath = root;
        }else{
            rootPath = System.getProperty("user.dir").replace("\\","/");
        }
    }

    //系统根目录
    public static final String rootPath;

    ////系统日志放置的根路径
    //public static final String LogsPath = rootPath+"/logs/";
    //
    ////图片资源放置的根路径
    //public static final String ImagesPath = rootPath + "/images/";
    //
    ////系统备份文件放置的根路径
    //public static final String BackUpPath = rootPath + "/backup/";
    //
    ////临时文件放置目录
    //public static final String TempPath = rootPath + "/temp/";
    //
    //// 升级文件放置路径
    //public static final String UpgradePath = rootPath + "/upgrade/";

    /**
     *     打包前文件存放路径
     */
    //结果
//    public static final String BeforePackageResult = rootPath + "\\files\\result\\package\\AssessmentResults\\";
    //照片
//    public static final String BeforePackagePhoto = rootPath + "\\files\\result\\package\\Photos\\";
    //打包信息 txt
//    public static final String BeforePackageBasePath = rootPath + "\\files\\result\\package\\";

    //随机文件夹基础路径
    //public static final String RandomPackageBasePath = rootPath + "/files/result/package";




    //客户端信息保存根路径
    //public static String PcInfoRootPath = rootPath + "/pcInfo/";
    //考生照片存放路径
    public static String ExamineePhotoPath = rootPath + "/files/photos/";
    //考生试卷存放路径
    public static String ExamineePaperPath = rootPath +"/files/papers/";
    //获取考试计划包目录
    //public String PackagePath(String orgId,Integer siteId){
    //    return String.format("%s/files/package/%s/%s/",rootPath,orgId,siteId);
    //}

    //作答结果压缩包保存路径
    public static String ResultPackagePath(String orgId, String siteId, String planId)
    {
        return String.format("%s/%s/%s/files/result/%s/%s/%s/", rootPath, planId ,siteId ,orgId, siteId, planId);
    }




    public static void main(String[] args) {

//        String appID = "1";
//        String examSiteID = "2";
//        Integer planId = 3;
//        String folderFormat = "%sassasas\\%s\\%s\\%s\\%s";
//        String folder = rootPath+"\\files\\Result\\"+appID+"\\"+examSiteID+"\\"+planId;
//        System.out.println("folder="+folder);
//        folder = String.format(folderFormat,rootPath,"files\\Result",appID,examSiteID,planId);
//        String substring = BeforePackagePhoto.substring(0, BeforePackagePhoto.lastIndexOf("\\"));
//        System.out.println(substring);
    }


}
